
import shModal from '../components/sh-modal/sh-modal';
export default {
    components: { shModal },
    data () {
        return {
            tabValue: 'machine-layout',
            detailModalState: false,
            dataList: [],
            machineCode: '',
            isPresentFullScreen: false,
            showLoading: false,
            clientHeight: 0,
            millisecond: 5000,
            configPropsModalState: false,
            setData: [],
            // 属性列表的modal
            propsListModalState: false,
            showProcess: '',
            configPropsListApi: '',
            processParams: '',
            // 各个工序的属性 list api
            showPropsListApiMap: {
                'qing-hua': 'QH',
                'shu-mian': 'SM',
                'yu-bing': 'YB',
                'tiao-juan': 'TJ',
                'jing-shu': 'JS',
                'mo-bing': 'MB',
                'cu-sha': 'CS',
                'xi-sha': 'XS',
                'luo-tong': 'LT',
            }
        };
    },
    methods: {
        propsListModalStateEvent (e) {
            this.propsListModalState = e;
            if (!e) {
                this.processParams = '';
            };
        },
        addPropsEvent () {
            this.propsListModalState = true;
            this.processParams = this.showPropsListApiMap[this.$route.name];
        },
        // 全屏事件
        fullScreenEvent () {
            let main = document.getElementsByClassName('content-bar')[0];
            if (!this.isPresentFullScreen) {
                if (main.requestFullscreen) {
                    main.requestFullscreen();
                } else if (main.mozRequestFullScreen) {
                    main.mozRequestFullScreen();
                } else if (main.webkitRequestFullScreen) {
                    main.webkitRequestFullScreen();
                } else if (main.msRequestFullscreen) {
                    main.msRequestFullscreen();
                }
                this.isPresentFullScreen = true;
            } else {
                if (document.exitFullscreen) {
                    document.exitFullscreen();
                } else if (document.mozCancelFullScreen) {
                    document.mozCancelFullScreen();
                } else if (document.webkitCancelFullScreen) {
                    document.webkitCancelFullScreen();
                } else if (document.msExitFullscreen) {
                    document.msExitFullscreen();
                }
                this.isPresentFullScreen = false;
            };
        },
        getTabEvent (e) {
            this.routerPath = e;
            this.dynamicComponents = e;
            this.$router.push({ path: e });
        },
    },
    mounted () {
        this.clientHeight = document.documentElement.clientHeight - 56;
        window.addEventListener('resize', () => {
            this.clientHeight = document.documentElement.clientHeight - 56;
        });
    }
}
